class Role:
    def __init__(self, name, gender, weapon):
        '该方法被称作构造器方法，用于将属性绑定在实例身上'
        # self不是关键字，可以是任意的合法名称
        self.name = name
        self.gender = gender
        self.weapon = weapon

    def show_me(self):
        # 绑定在实例身上的属性，可以用在类中的任何地方
        print('我是%s，我擅用%s' % (self.name, self.weapon))


class Warrior(Role):  # 继承于Role，括号中是父类
    # def __init__(self, name, gender, weapon, health):
    #     self.name = name
    #     self.gender = gender
    #     self.weapon = weapon
    #     self.health = health

    def __init__(self, name, gender, weapon, health):
        Role.__init__(self, name, gender, weapon)
        self.health = health

    def attack(self, target):
        print('近身攻击: %s' % target)

if __name__ == '__main__':
    lb = Warrior('吕布', '男', '方天画戟', 800)